package com.biz.primus.model.order.enums;

import com.biz.primus.common.enums.EnumerableValue;
import com.biz.primus.common.enums.converter.BaseEnumValueConverter;

/**
 * 支付方式
 *
 * @author Tiger Feng
 * @date 2017年10月28日
 */
public enum OrderPaymentWay implements EnumerableValue {
    alipay(10, "支付宝支付"),
    wechatpay(20, "微信支付"),
    cod(30, "货到付款"),
    balance(40, "电子钱包支付"),
    unionpay(50, "银联支付"),
//    winepay(60, "储值卡支付"),
//    whitebar(70, "白条支付"),
//    swiftpay(80, "威富通支付"),
    ;

    private final int value;
    private final String desc;

    @Override
    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    OrderPaymentWay(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static class Converter extends BaseEnumValueConverter<OrderPaymentWay> {
    }

    public static OrderPaymentWay valueOf(NormalPaymentWay normalPaymentWay) {
        return valueOf(normalPaymentWay.name());
    }

    /**
     * 嵌套,用于区分某些限制条件下可用的支付方式
     *
     * @author Tiger Feng
     */
    public enum NormalPaymentWay {

        alipay(10, "支付宝支付"),
        wechatpay(20, "微信钱包支付"),
        balance(40, "电子钱包支付"),
        unionpay(50, "银联支付"),
        swiftpay(80, "威富通支付");

        private final int value;
        private final String desc;

        public int getValue() {
            return value;
        }

        public String getDesc() {
            return desc;
        }

        NormalPaymentWay(int value, String desc) {
            this.value = value;
            this.desc = desc;
        }
    }
}
